#include<iostream>
using namespace std;
int main()
{
	int g,i,num,max,min;
	cin>>g;
	for(i=1;i<=g;i++)
	{
		cin>>num;
		if(i==1) 
		{
			max=num;
			min=num;
		}
		else
		{
			if(num>max) max=num;
			if(num<min) min=num;
		}
	
	}
	cout<<max-min<<endl;
	return 0;
}
